<template>
  <div class="app-container">
    <el-tabs v-model="activeName" class="demo-tabs">
      <el-tab-pane label="电脑端" name="pc">
        <matTable ref="pcTable" v-model="activeName"></matTable>
      </el-tab-pane>
      <el-tab-pane label="平板端" name="pad">
        <matTable ref="padTable" v-model="activeName"></matTable>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script setup name="Stock">
import { nextTick } from "vue";
import matTable from "./matTable.vue";
const activeName = ref("pc");
const pcTable = ref("pcTable");
const padTable = ref("padTable");
// nextTick(() => {
//   pcTable?.value?.getList(activeName.value);
// });
setTimeout(() => {
  pcTable?.value?.getList(activeName.value);
}, 100);
watch(
  () => activeName.value,
  (newValue, oldValue) => {
    if (activeName.value === "pc") {
      pcTable.value.getList(newValue);
    }
    if (activeName.value === "pad") {
      padTable.value.getList(newValue);
    }
  }
  // { immediate: true, deep: true }
);
</script>
